/*
 *  Copyright 2020-2025 the original author or authors.
 *  You cannot use this file unless authorized by the author.
 */

package org.ipig.search;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

/**
 * 文档信息
 *
 * @author <a href="mailto:comchnts@163.com">chinats</a>
 * @version $$Id$$
 * @since 1.0
 */
@Data
public class DocInfo {
    /** 文档索引名称 */
    private String indexName;
    /** 文档索引类型 */
    private String indexTypeName;
    /** 文档 ID */
    private String docId;
    /** 对文档的操作 */
    private DocOperate docOperate;
    /** 文档 Field的 K/V键值对 */
    private Map<String, Object> kvFieldMap;

    /**
     * @return the kvFieldMap
     */
    public Map<String, Object> getKvFieldMap() {
        if (kvFieldMap == null) {
            kvFieldMap = new HashMap<String, Object>();
        }
        return kvFieldMap;
    }

    /**
     * 文档操作
     *
     * @author <a href="mailto:tansheng@zjport.gov.cn">tansheng</a>
     * @version $Id: DocInfo.java 1847 2018-04-23 11:33:33Z tansheng $
     * @since 1.0
     */
    public enum DocOperate {
        /** INSERT */
        I,
        /** UPDATE */
        U,
        /** DELETE */
        D;
    }
}

